﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

namespace METU_CMT.Business
{
    public class Note
    {
        private int noteId;
        private DateTime uploadTime;
        private string file;
        private string name;

        public DateTime UploadTime
        {
            get { return uploadTime; }
            set { uploadTime = value; }
        }

        public string File
        {
            get { return file; }
            set { file = value; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public int NoteId
        {
            get { return noteId; }
            set { noteId = value; }
        }

        public void Download()
        {
            string _ext = Path.GetExtension(File);
            FileType _type = CommonMethods.GetFileType(_ext);
            CommonMethods.DownloadFile(HttpContext.Current.Response,
                                       HttpContext.Current.Server.MapPath("~/LectureNotes/" + File), _type);
        }
    }

    public enum FileType
    {
        Word, Excel, Pdf, Zip, NA
    }
}